// #include"ThreadPool.hpp"
// #include"Task.hpp"
// // #include<memory>

// int main()
// {
//     // std::unique_ptr<ThreadPool>tp=std::make_unique<>();//c++14

//     ThreadPool<int> *tp = new ThreadPool<int>();
//     tp->Init();
//     tp->Start();
//     int cnt = 10;
//     while (cnt)
//     {
//         // 不断向线程池推送任务
//         sleep(1);

//         Task t(1, 1);
//         tp->Equeue(t);
//         // ThreadPool<Task>::GetInstance()->Equeue(t);
//         // LOG(INFO, "equeue a task, %s\n", t.debug().c_str());
//         sleep(1);
//         std::cout<<"cnt: "<<cnt<<std::endl;
//         cnt--;
//     }

//     tp->Stop();
//     std::cout<<"thread pool stop"<<std::endl;
//     sleep(10);
//     return 0;
// }


#include "ThreadPool.hpp"
#include "Task.hpp"
#include "Log.hpp"
// #include <memory>

using namespace log_ns;

int main()
{
    //std:cout<<GetCurrTime()<<endl;
    //Log lg;
   // lg.Enable(FILE_TYPE);
    //lg.logmessage("main.cc",10,DEBUG,"hello %d,world :%c,hello:%f\n",1000,'A',3.14);
    //lg.logmessage("main.cc",10,DEBUG,"hello %d,world :%c,hello:%f\n",1000,'A',3.14);
    //lg.logmessage("main.cc",10,DEBUG,"hello %d,world :%c,hello:%f\n",1000,'A',3.14);
    //lg.logmessage("main.cc",10,DEBUG,"hello %d,world :%c,hello:%f\n",1000,'A',3.14);
    //lg.logmessage("main.cc",10,DEBUG,"hello %d,world :%c,hello:%f\n",1000,'A',3.14);
    //lg.logmessage(__FILE__,__LINE__,DEBUG,"hello %d,world :%c,hello:%f\n",1000,'A',3.14);
    //
    EnableScreen();
    //Log(DEBUG,"hello %d,world :%c,hello:%f\n",1000,'A',3.14);
    //Log(DEBUG,"hello %d,world :%c,hello:%f\n",1000,'A',3.14);
    //Log(DEBUG,"hello %d,world :%c,hello:%f\n",1000,'A',3.14);
    //Log(DEBUG,"hello %d,world :%c,hello:%f\n",1000,'A',3.14);
    //EnableFILE();
    //Log(DEBUG,"hello %d,world :%c,hello:%f\n",1000,'A',3.14);
    //Log(DEBUG,"hello %d,world :%c,hello:%f\n",1000,'A',3.14);
    //Log(DEBUG,"hello %d,world :%c,hello:%f\n",1000,'A',3.14);
    //Log(DEBUG,"hello %d,world :%c,hello:%f\n",1000,'A',3.14);




    // std::unique_ptr<ThreadPool> tp = std::make_unique<ThreadPool>(); //c++14
    // ThreadPool<Task> *tp = new ThreadPool<Task>();
    // tp->Init();
    // tp->Start();
    int cnt = 10;
    while(cnt)
    {
        // 不断地向线程池推送任务
        sleep(1);
        Task t(1,1);
        ThreadPool<Task>::GetInstance()->Equeue(t);
        LOG(INFO, "equeue a task, %s\n", t.debug().c_str());
        sleep(1);
        cnt--;
    }

    ThreadPool<Task>::GetInstance()->Stop();
    LOG(INFO, "thread pool stop!\n");
    return 0;
}